/**
 */
package ConnectorGenerator.impl;

import ConnectorGenerator.ConnectorDatabase;
import ConnectorGenerator.ConnectorGeneratorPackage;
import ConnectorGenerator.ConnectorSpecification;

import ConnectorGenerator.DRD.DRDDocument;

import ConnectorGenerator.FlatConnectorSpecification;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Connector Specification</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ConnectorGenerator.impl.ConnectorSpecificationImpl#getDrdDocument <em>Drd Document</em>}</li>
 *   <li>{@link ConnectorGenerator.impl.ConnectorSpecificationImpl#getConnectorDatabase <em>Connector Database</em>}</li>
 *   <li>{@link ConnectorGenerator.impl.ConnectorSpecificationImpl#getFlatConnectorSpecification <em>Flat Connector Specification</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ConnectorSpecificationImpl extends EObjectImpl implements ConnectorSpecification {
	/**
	 * The cached value of the '{@link #getDrdDocument() <em>Drd Document</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDrdDocument()
	 * @generated
	 * @ordered
	 */
	protected DRDDocument drdDocument;

	/**
	 * The cached value of the '{@link #getConnectorDatabase() <em>Connector Database</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getConnectorDatabase()
	 * @generated
	 * @ordered
	 */
	protected ConnectorDatabase connectorDatabase;

	/**
	 * The cached value of the '{@link #getFlatConnectorSpecification() <em>Flat Connector Specification</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFlatConnectorSpecification()
	 * @generated
	 * @ordered
	 */
	protected FlatConnectorSpecification flatConnectorSpecification;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ConnectorSpecificationImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ConnectorGeneratorPackage.Literals.CONNECTOR_SPECIFICATION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DRDDocument getDrdDocument() {
		return drdDocument;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetDrdDocument(DRDDocument newDrdDocument, NotificationChain msgs) {
		DRDDocument oldDrdDocument = drdDocument;
		drdDocument = newDrdDocument;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__DRD_DOCUMENT, oldDrdDocument, newDrdDocument);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDrdDocument(DRDDocument newDrdDocument) {
		if (newDrdDocument != drdDocument) {
			NotificationChain msgs = null;
			if (drdDocument != null)
				msgs = ((InternalEObject)drdDocument).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__DRD_DOCUMENT, null, msgs);
			if (newDrdDocument != null)
				msgs = ((InternalEObject)newDrdDocument).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__DRD_DOCUMENT, null, msgs);
			msgs = basicSetDrdDocument(newDrdDocument, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__DRD_DOCUMENT, newDrdDocument, newDrdDocument));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConnectorDatabase getConnectorDatabase() {
		return connectorDatabase;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetConnectorDatabase(ConnectorDatabase newConnectorDatabase, NotificationChain msgs) {
		ConnectorDatabase oldConnectorDatabase = connectorDatabase;
		connectorDatabase = newConnectorDatabase;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__CONNECTOR_DATABASE, oldConnectorDatabase, newConnectorDatabase);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setConnectorDatabase(ConnectorDatabase newConnectorDatabase) {
		if (newConnectorDatabase != connectorDatabase) {
			NotificationChain msgs = null;
			if (connectorDatabase != null)
				msgs = ((InternalEObject)connectorDatabase).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__CONNECTOR_DATABASE, null, msgs);
			if (newConnectorDatabase != null)
				msgs = ((InternalEObject)newConnectorDatabase).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__CONNECTOR_DATABASE, null, msgs);
			msgs = basicSetConnectorDatabase(newConnectorDatabase, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__CONNECTOR_DATABASE, newConnectorDatabase, newConnectorDatabase));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FlatConnectorSpecification getFlatConnectorSpecification() {
		if (flatConnectorSpecification != null && flatConnectorSpecification.eIsProxy()) {
			InternalEObject oldFlatConnectorSpecification = (InternalEObject)flatConnectorSpecification;
			flatConnectorSpecification = (FlatConnectorSpecification)eResolveProxy(oldFlatConnectorSpecification);
			if (flatConnectorSpecification != oldFlatConnectorSpecification) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__FLAT_CONNECTOR_SPECIFICATION, oldFlatConnectorSpecification, flatConnectorSpecification));
			}
		}
		return flatConnectorSpecification;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FlatConnectorSpecification basicGetFlatConnectorSpecification() {
		return flatConnectorSpecification;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFlatConnectorSpecification(FlatConnectorSpecification newFlatConnectorSpecification) {
		FlatConnectorSpecification oldFlatConnectorSpecification = flatConnectorSpecification;
		flatConnectorSpecification = newFlatConnectorSpecification;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__FLAT_CONNECTOR_SPECIFICATION, oldFlatConnectorSpecification, flatConnectorSpecification));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__DRD_DOCUMENT:
				return basicSetDrdDocument(null, msgs);
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__CONNECTOR_DATABASE:
				return basicSetConnectorDatabase(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__DRD_DOCUMENT:
				return getDrdDocument();
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__CONNECTOR_DATABASE:
				return getConnectorDatabase();
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__FLAT_CONNECTOR_SPECIFICATION:
				if (resolve) return getFlatConnectorSpecification();
				return basicGetFlatConnectorSpecification();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__DRD_DOCUMENT:
				setDrdDocument((DRDDocument)newValue);
				return;
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__CONNECTOR_DATABASE:
				setConnectorDatabase((ConnectorDatabase)newValue);
				return;
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__FLAT_CONNECTOR_SPECIFICATION:
				setFlatConnectorSpecification((FlatConnectorSpecification)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__DRD_DOCUMENT:
				setDrdDocument((DRDDocument)null);
				return;
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__CONNECTOR_DATABASE:
				setConnectorDatabase((ConnectorDatabase)null);
				return;
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__FLAT_CONNECTOR_SPECIFICATION:
				setFlatConnectorSpecification((FlatConnectorSpecification)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__DRD_DOCUMENT:
				return drdDocument != null;
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__CONNECTOR_DATABASE:
				return connectorDatabase != null;
			case ConnectorGeneratorPackage.CONNECTOR_SPECIFICATION__FLAT_CONNECTOR_SPECIFICATION:
				return flatConnectorSpecification != null;
		}
		return super.eIsSet(featureID);
	}

} //ConnectorSpecificationImpl
